package edu.maping.easy.sequence.ticker;

import edu.maping.easy.fisica.EasyMappingFisica;
import edu.maping.easy.gui.GuiFactory;
import edu.maping.easy.model.Thing;
import processing.core.PApplet;
import processing.xml.XMLElement;

public class CollisionTicker implements Ticker {

	private boolean trigger = false;

	public EasyMappingFisica fisica;

	@Override
	public boolean isTrigerred() {
		return trigger;
	}

	@Override
	public void updateTrigger(PApplet pApplet, Thing thing) {
		int index = fisica.contacted.indexOf(thing);
		if (index > -1) {
			fisica.contacted.remove(thing);
			trigger = true;
		}else{
			trigger = false;
		}
	}

	@Override
	public String getName() {
		return "Collision Ticker";
	}

	@Override
	public Ticker newTicker() {
		CollisionTicker collisionTicker = new CollisionTicker();
		collisionTicker.fisica = fisica;
		return collisionTicker;
	}

	@Override
	public boolean isReadyToNewTicker() {
		return true;
	}

	@Override
	public boolean setReadyToNewTicker() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public void desXmlIzation(XMLElement seqsElement) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public XMLElement xmlIzation() {
		// TODO Auto-generated method stub
		return null;
	}
}
